/**
 * 组织机构树
 */
Ext.define('Pearlsen.form.orgTriggerField', {
	extend:'Pearlsen.form.pTriggerField',
	alias: 'widget.orgTriggerField',
	initComponent:function(){
		if(!this.hiddenId){
			throw new Error("Pearlsen.form.orgTrigger  hiddenId undefined");
       };
		this.callParent(arguments);
	},
	onTriggerClick:function(){
		var me = this;
		if(!this.treeWin){
			var treeStore = Ext.create('Pearlsen.PTreeStore',{
				model:'OrgNodeModel',
				handlerName:'OrgQueryHandler',
				handlerMethod:'getChildren',
				datasetName:'OrgDataSetHandler',
				defaultRootId:'0',
				root:{
					text:'Root',
					id:'0',
					expanded:true
				},
				listeners:{
					beforeload:function(){
						var args = Array.prototype.slice.call(arguments, 0);
						Pls.TAG.COMMON.treeStoreBeforeload.apply(this, args);
					}
				}

			});

			var tree =Ext.create('Ext.tree.Panel',{
				id:'orgTree2',
				store:treeStore,
				rootVisible:false
			});
			this.treeWin = Ext.create('widget.window',{
				title:"组织机构",
				width: 300,
                height: 400,
                layout:'fit',
                items:tree,
                modal:true,
                buttons:[
                	{text:'确定',handler:function(){
                		var record = tree.getSelectionModel().getLastSelected();
							if(!record){
								Pearlsen.Utils.showInfoMsg('请选择一个部门!');
			    	            return false;
							}
                			Ext.getCmp(me.hiddenId).setValue(record.get('id'));
                			me.setValue(record.get('text'));
							me.treeWin.hide();
							
                	}},
                	{text:'取消',handler:function(){
                		me.treeWin.hide();
                	}}
                ]
			});
		}
		me.treeWin.show();
	}
});

/**
 * 状态下来框
 */
Ext.define('Pearlsen.form.statusComboBox', {
	extend:'Ext.form.field.ComboBox',
	alias: 'widget.statusComboBox',
	store:[['1','启用'],['0','停用']]
});

/**
 * 性别下来框
 */
Ext.define('Pearlsen.form.sexComboBox', {
	extend:'Ext.form.field.ComboBox',
	alias: 'widget.sexComboBox',
	store:[['男','男'],['女','女']]
});